// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Vuex from 'vuex'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'font-awesome/css/font-awesome.min.css'
import 'nprogress/nprogress.css'
import "./assets/iconfont/iconfont.css"
import './common/ztree/jquery-1.4.4.min'
import './common/ztree/jquery.ztree.all.min'
import './common/ztree/css/metroStyle.css'
import Contextmenu from 'e-vue-contextmenu'
import SlideVerify from 'vue-monoplasty-slide-verify';
import store from './store'
import storage from 'good-storage'
import promise from 'es6-promise'
import iconPicker from 'e-icon-picker';
import VueParticles from 'vue-particles'

import { codemirror } from 'vue-codemirror'
import 'codemirror/lib/codemirror.css'

import hasPermisssion from './common/utils/hasPermission.js'

import './assets/global/layout/index.css'
import './assets/global/element-ui/index.css'

import './components/index.js'

import './assets/svgIcon'

import App from './App'

import router from './router'

Vue.config.productionTip = false

Vue.use(Vuex).use(ElementUI)
  .use(Contextmenu)
  .use(iconPicker)
  .use(SlideVerify)
  .use(VueParticles)
  .use(codemirror);

promise.polyfill();

Vue.directive('focus', {
  // 当绑定元素插入到 DOM 中。
  inserted: function(el) {
    if (el.tagName.toLocaleLowerCase() == 'input') {
      el.focus()
    } else {
      if (el.getElementsByTagName('input')) {
        el.getElementsByTagName('input')[0].focus()
      }
    }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  storage,
  components: {
    App
  },
  template: '<App/>'
})
